<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>商品详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="full-screen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta name="format-detection" content="telephone=no"/>
    <meta name="format-detection" content="address=no">
    <script src="../../js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript">
        var docEl = document.documentElement;
        var clientWidth = docEl.clientWidth;
        docEl.style.fontSize = (clientWidth / 10) + 'px';
        $(document).ready(function () {
            (function (doc, win) {
                var docEl = doc.documentElement,
                        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                        recalc = function () {
                            var clientWidth = docEl.clientWidth;
                            docEl.style.fontSize = (clientWidth / 10) + 'px';
                        };

                if (!doc.addEventListener) return;
                win.addEventListener(resizeEvt, recalc, false);
                doc.addEventListener('DOMContentLoaded', recalc, false);
            })(document, window);
        });
    </script>
    <link rel="stylesheet" href="../../style/css/index.css"/>
</head>
<body>
<div style="background: #f7f7f7;width: 100%;height: 100%">
    <!--header-->
    <div class="header">
        <img class="back" onclick="history.go(-1);" src="../../style/images/sg_ic_back.png" alt=""/>

        <p class="orderName">商品详情</p>
    </div>
    <!-- content-->
    <div class="xq_main" id="xq_main">
        <!--<img class="food_picshow" src="../../updata/food_picshow.jpg" alt=""/>-->
        <!--<div class="price_show">-->
        <!--<span>￥99</span>-->
        <!--<s>￥199</s>-->
        <!--</div>-->
        <!--<div class="introduce">-->
        <!--<p class="p1">美国进口车厘子2kg</p>-->
        <!--<p class="p2">呀，甜到像被亲了一口，美国果园全程冷链空运直送，品质保障</p>-->
        <!--</div>-->
    </div>
    <div id="type2">

    </div>
    <p class="guess">猜你喜欢</p>
    <ul class="guess_show" id="guess_show">
        <!--<li>-->
        <!--<img src="../../updata/foodImg1.jpg" alt=""/>-->
        <!--<p>￥15</p>-->
        <!--</li>-->
        <!--<li>-->
        <!--<img src="../../updata/foodImg1.jpg" alt=""/>-->
        <!--<p>￥15</p>-->
        <!--</li>-->
        <!--<li>-->
        <!--<img src="../../updata/foodImg1.jpg" alt=""/>-->
        <!--<p>￥15</p>-->
        <!--</li>-->
        <!--<li>-->
        <!--<img src="../../updata/foodImg1.jpg" alt=""/>-->
        <!--<p>￥15</p>-->
        <!--</li>-->
        <!--<li>-->
        <!--<img src="../../updata/foodImg1.jpg" alt=""/>-->
        <!--<p>￥15</p>-->
        <!--</li>-->
        <!--<li>-->
        <!--<img src="../../updata/foodImg1.jpg" alt=""/>-->
        <!--<p>￥15</p>-->
        <!--</li>-->

    </ul>
    <div class="clear"></div>
    <p class="pro_intro">商品介绍:</p>

    <div id="info" style="width: 100%;overflow: hidden;">

    </div>
    <div style="height: 1.46rem;width: 100%"></div>
</div>

<!--footer-->
<div class="footer" id="footer">
    <!--<ul class="footer_ico">-->
    <!--<li>-->
    <!--<img src="../../style/images/sg_ic_lxkf.png">-->
    <!--<p>客服</p>-->
    <!--</li>-->
    <!--<li id="fllow">-->
    <!--<img id="sg_ic_shoucang_1" src="../../style/images/sg_ic_shoucang_1.png">-->
    <!--<p>收藏</p>-->
    <!--</li>-->
    <!--<li id="shopCar">-->
    <!--<img src="../../style/images/pro_btn_shopping_n.png">-->
    <!--<p>购物车</p>-->
    <!--</li>-->
    <!--</ul>-->
    <!--<div class="pay" id="buy">立即购买</div>-->
    <!--<div class="pay" id="jion_car" style="background:#ff2640; color:#fff;">加入购物车</div>-->
</div>
<script src="../../js/md5.js"></script>
<script src="../../js/md5_need.js"></script>
<script src="../../js/queryString.js"></script>
<script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
        var type = '';
        var orderID = '';
        var price = '';
        var good_price='';
        var postage='';
        var indexJs = {
            getuser: function () {
                var data = {
                    apiCode: '_login_001',
                    username: 18368169357,
                    loginPass: 123456
                };
                http(data, function (responed) {
                    var $info = responed.info;
                    var $userToken = $info.userToken;
                    window.localStorage.setItem("userToken", $userToken);
                })
            },
            getfruit: function () {
                var data = {
                    apiCode: '_goods_info_001',
                    id: QueryString.id
                };
                http(data, function (responed) {
                    console.log(responed);
                    var $info = responed.info;
                    var $goodinfo = $info.goodinfo;
                    var $recommendgoods = $info.recommendgoods;
                    var $type = $goodinfo.type;
                    type = $goodinfo.type;
                    console.log($type);
                    if ($type == 1) {
                        var temp = '';
                        $.each($goodinfo.img_path, function (i, n) {
                            temp += '<img class="food_picshow" src="' + n + '" alt=""/>';
                        });
                        temp += '<div class="price_show">';
                        temp += '<span>￥' + $goodinfo.original_price + '</span>';
                        temp += '<s>￥' + $goodinfo.min_price + '</s>';
                        temp += '</div>';
                        temp += '<div class="introduce">';
                        temp += '<p class="p1">' + $goodinfo.title + '</p>';
                        temp += '<p class="p2">' + $goodinfo.sub_title + '</p>';
                        temp += '</div>';
                        $("#xq_main").append(temp);
                        good_price=$goodinfo.discount_price;
                        $.each($recommendgoods, function (i, n) {
                            var temp = '';
                            temp += '<li>';
                            temp += '<a href="details.html?id=' + n.id + '"><img src="' + n.img_path + '" alt=""/></a>';
                            temp += '<p>￥' + n.original_price + '</p>';
                            temp += '</li>';
                            $("#guess_show").append(temp);
                        });
                        var temp = '';
                        temp += '' + $goodinfo.info + '';
                        $("#info").append(temp);

                        var temp = '';
                        temp += '<ul class="footer_ico">';
                        temp += '<li>';
                        temp += '<img src="../../style/images/sg_ic_lxkf.png">';
                        temp += '<p>客服</p>';
                        temp += '</li>';
                        temp += '<li id="fllow">';
                        temp += '<img id="sg_ic_shoucang_1" src="../../style/images/sg_ic_shoucang_1.png">';
                        temp += '<p>收藏</p>';
                        temp += '</li>';
                        temp += '<li id="shopCar">';
                        temp += '<img src="../../style/images/pro_btn_shopping_n.png">';
                        temp += '<p>购物车</p>';
                        temp += '</li>';
                        temp += '</ul>';
                        temp += '<div class="pay" id="buy">立即购买</div>';
                        temp += '<div class="pay" id="jion_car" style="background:#ff2640; color:#fff;">加入购物车</div>';
                        $("#footer").append(temp);
                        postage=$goodinfo.postage;
                        $("#buy").click(function(){
                            indexJs.setOrder1();
                        })
                        
                    } else if ($type == (2 || 5)) {
                        var temp = '';
                        $.each($goodinfo.img_path, function (i, n) {
                            temp += '<img class="food_picshow" src="' + n + '" alt=""/>';
                        });
                        temp += '<div class="price_show">';
                        temp += '<span>￥' + $goodinfo.discount_price + '</span>';
                        temp += '<s>￥' + $goodinfo.original_price + '</s>';
                        temp += '<div class="fr psPhone" style=" margin-top: 0.5rem;"> ';
                        temp += '2人团';
//                    temp+='<img src="../../style/images/serch_del_into_4.png" alt=""/>';
                        temp += '</div>';
                        temp += '</div>';
                        temp += '<div class="introduce">';
                        temp += '<p class="p1">' + $goodinfo.title + '</p>';
                        temp += '<p class="p2">' + $goodinfo.sub_title + '</p>';
                        temp += '</div>';
                        temp += '</div>';
                        $("#xq_main").append(temp);

                        var temp = '';
                        temp += '<div class="contactWay" style="padding-bottom:0;">';
                        temp += '<div class="kan_title">';
                        temp += '<span class="s1">以下小伙伴正在团购中,快来助攻</span>';
                        temp += '<div class="clear"></div>';
                        temp += '</div>';
                        temp += '<ul class="help_p">';
                        temp += '<li class="hp_list">';
                        temp += '<img class="headImg" src="../../updata/banner.jpg">';
                        temp += '<div style="float:left;">';
                        temp += '<p style="font-size:12px;margin-left:5px;">加速离开大厦</span>';
                        temp += '<p style="font-size:12px;color:#666;margin-left:5px;">剩余23:10:21</p> ';
                        temp += '</div>';
                        temp += '<div class="fr psPhone" style=" margin-top:0.1rem;">  ';
                        temp += '去参团';
                        temp += '<img src="../../style/images/serch_del_into_4.png" alt=""/>';
                        temp += '</div>';
                        temp += '<div class="clear"></div>';
                        temp += '</li>';
                        temp += '</ul>';
                        temp += '</div>';
                        temp += '<div class="contactWay">';
                        temp += '<div class="kan_title">';
                        temp += '<span class="s1">砍价玩法</span>';
                        temp += '<span class="s2">查看详情</span>';
                        temp += '<div class="clear"></div>';
                        temp += '</div>';
                        temp += '<ul class="kan_rule">';
                        temp += '<li>';
                        temp += '<p>决定</p>';
                        temp += '<p>砍价</p>';
                        temp += '<span> > </span>';
                        temp += '</li>';
                        temp += '<li>';
                        temp += '<p>邀请好友</p>';
                        temp += '<p>帮忙砍价</p>';
                        temp += '<span> > </span>';
                        temp += '</li>';
                        temp += '<li>';
                        temp += '<p>好友帮忙</p>';
                        temp += '<p>砍价成功</p>';
                        temp += '<span> > </span>';
                        temp += '</li>';
                        temp += ' <li>';
                        temp += ' <p>决定</p>';
                        temp += '<p>购买</p>';
                        temp += ' </li>';
                        temp += '</ul>';
                        $("#type2").append(temp);

                        $.each($recommendgoods, function (i, n) {
                            var temp = '';
                            temp += '<li>';
                            temp += '<a href="details.html?id=' + n.id + '"><img src="' + n.img_path + '" alt=""/></a>';
                            temp += '<p>￥' + n.original_price + '</p>';
                            temp += '</li>';
                            $("#guess_show").append(temp);
                        });
                        var temp = '';
                        temp += '' + $goodinfo.info + '';
                        $("#info").append(temp);

                        var temp = '';
                        temp += '<ul class="footer_ico">';
                        temp += '<li>';
                        temp += '<img src="../../style/images/sg_ic_lxkf.png">';
                        temp += '<p>客服</p>';
                        temp += '</li>';
                        temp += '<li id="fllow">';
                        temp += '<img id="sg_ic_shoucang_1" src="../../style/images/sg_ic_shoucang_1.png">';
                        temp += '<p>收藏</p>';
                        temp += '</li>';
                        temp += '<li id="shopCar">';
                        temp += '<img src="../../style/images/pro_btn_shopping_n.png">';
                        temp += '<p>购物车</p>';
                        temp += '</li>';
                        temp += '</ul>';
                        temp += '<div class="pay" id="buy">立即购买</div>';
                        temp += '<div class="pay" id="jion_car" style="background:#ff2640; color:#fff;">加入购物车</div>';
                        $("#footer").append(temp);
                        postage=$goodinfo.postage;
                        good_price=$goodinfo.discount_price;
                        $("#buy").click(function(){
                            indexJs.setOrder2();
                        })
                    } else if ($type == 3) {
                        var temp = '';
                        $.each($goodinfo.img_path, function (i, n) {
                            temp += '<img class="food_picshow" src="' + n + '" alt=""/>';
                        });
                        temp += '<div class="price_show">';
                        temp += '<span>￥' + $goodinfo.original_price + '</span>';
                        temp += '<s>￥' + $goodinfo.min_price + '</s>';
                        temp += '<div class="fr psPhone" style=" margin-top: 0.5rem;"> ';
                        temp += '已打8折';
                        temp += '</div>';
                        temp += '</div>';
                        temp += '<div class="introduce">';
                        temp += '<p class="p1">' + $goodinfo.title + '</p>';
                        temp += '<p class="p2">' + $goodinfo.sub_title + '</p>';
                        temp += '</div>';
                        temp += '</div>';
                        $("#xq_main").append(temp);

                        var temp = '';
                        // temp+='';
                        temp += '<div class="contactWay">';
                        temp += '<p style="font-size:12px; width:94%;margin:0 auto;color:#999;">';
                        temp += '活动时间：';
                        temp += '<span style="color:#333;">'+$goodinfo.create_time+'</span>';
                        temp += '</p>';
                        temp += '</div>';
                        temp += '<div class="contactWay">';
                        temp += '<div class="kan_title">';
                        temp += ' <span class="s1">活动规则：</span>';
                        temp += ' <span class="s2"></span>';
                        temp += ' <div class="clear"></div>';
                        temp += '</div>';
                        temp += '<ul class="kan_rule">';
                        temp += ' <li>';
                        temp += '  <p>决定</p>';
                        temp += '<p>砍价</p>';
                        temp += '<span> > </span>';
                        temp += '</li>';
                        temp += ' <li>';
                        temp += ' <p>邀请好友</p>';
                        temp += ' <p>帮忙砍价</p>';
                        temp += '<span> > </span>';
                        temp += ' </li>';
                        temp += ' <li>';
                        temp += ' <p>好友帮忙</p>';
                        temp += '<p>砍价成功</p>';
                        temp += '<span> > </span>';
                        temp += '</li>';
                        temp += ' <li>';
                        temp += ' <p>决定</p>';
                        temp += '<p>购买</p>';
                        temp += ' </li>';
                        temp += '</ul>';
                        $("#type2").append(temp);

                        $.each($recommendgoods, function (i, n) {
                            var temp = '';
                            temp += '<li>';
                            temp += '<a href="details.html?id=' + n.id + '"><img src="' + n.img_path + '" alt=""/></a>';
                            temp += '<p>￥' + n.original_price + '</p>';
                            temp += '</li>';
                            $("#guess_show").append(temp);
                        });
                        var temp = '';
                        temp += '' + $goodinfo.info + '';
                        $("#info").append(temp);

                        var temp = '';
                        temp += '<ul class="footer_ico">';
                        temp += '<li>';
                        temp += '<img src="../../style/images/sg_ic_lxkf.png">';
                        temp += '<p>客服</p>';
                        temp += '</li>';
                        temp += '<li id="fllow">';
                        temp += '<img id="sg_ic_shoucang_1" src="../../style/images/sg_ic_shoucang_1.png">';
                        temp += '<p>收藏</p>';
                        temp += '</li>';
                        temp += '<li id="shopCar">';
                        temp += '<img src="../../style/images/pro_btn_shopping_n.png">';
                        temp += '<p>购物车</p>';
                        temp += '</li>';
                        temp += '</ul>';
                        temp += '<div class="pay" id="buy">立即购买</div>';
                        temp += '<div class="pay" id="jion_car" style="background:#ff2640; color:#fff;">加入购物车</div>';
                        $("#footer").append(temp);
                    } else if ($type == 4) {
                        var temp = '';
                        $.each($goodinfo.img_path, function (i, n) {
                            temp += '<img class="food_picshow" src="' + n + '" alt=""/>';
                        });
                        temp += '<div class="price_show">';
                        temp += '<span>￥' + $goodinfo.original_price + '</span>';
                        temp += '<s>￥' + $goodinfo.min_price + '</s>';
                        temp += '<div class="fr psPhone" style=" margin-top: 0.5rem;"> ';
                        temp += '2人团';
                        temp += '</div>';
                        temp += '</div>';
                        temp += '<div class="introduce">';
                        temp += '<p class="p1">' + $goodinfo.title + '</p>';
                        temp += '<p class="p2">' + $goodinfo.sub_title + '</p>';
                        temp += '</div>';
                        temp += '</div>';
                        $("#xq_main").append(temp);

                        var temp = '';
                        // temp+='';
                        temp += '<div class="contactWay">';
                        temp += '<p style="font-size:12px; width:94%;margin:0 auto;color:#999;">';
                        temp += '活动时间：';
                        temp += '<span style="color:#333;">10:00-12:00</span>';
                        temp += '</p>';
                        temp += '</div>';
                        temp += '<div class="contactWay">';
                        temp += '<p style="font-size:12px; width:94%;margin:0 auto;color:#999;">';
                        temp += '活动规则：';
                        temp += '<span style="color:#333;">10:00-12:00</span>';
                        temp += '</p>';
                        temp += '</div>';
                        temp += '<div class="contactWay">';
                        temp += '<div class="kan_title">';
                        temp += ' <span class="s1">砍价玩法</span>';
                        temp += ' <span class="s2">查看详情</span>';
                        temp += ' <div class="clear"></div>';
                        temp += '</div>';
                        temp += '<ul class="kan_rule">';
                        temp += ' <li>';
                        temp += '  <p>决定</p>';
                        temp += '<p>砍价</p>';
                        temp += '<span> > </span>';
                        temp += '</li>';
                        temp += ' <li>';
                        temp += ' <p>邀请好友</p>';
                        temp += ' <p>帮忙砍价</p>';
                        temp += '<span> > </span>';
                        temp += ' </li>';
                        temp += ' <li>';
                        temp += ' <p>好友帮忙</p>';
                        temp += '<p>砍价成功</p>';
                        temp += '<span> > </span>';
                        temp += '</li>';
                        temp += ' <li>';
                        temp += ' <p>决定</p>';
                        temp += '<p>购买</p>';
                        temp += ' </li>';
                        temp += '</ul>';
                        $("#type2").append(temp);

                        $.each($recommendgoods, function (i, n) {
                            var temp = '';
                            temp += '<li>';
                            temp += '<a href="details.html?id=' + n.id + '"><img src="' + n.img_path + '" alt=""/></a>';
                            temp += '<p>￥' + n.original_price + '</p>';
                            temp += '</li>';
                            $("#guess_show").append(temp);
                        });
                        var temp = '';
                        temp += '' + $goodinfo.info + '';
                        $("#info").append(temp);

                        var temp = '';
                        temp += '<ul class="footer_ico">';
                        temp += '<li>';
                        temp += '<img src="../../style/images/sg_ic_lxkf.png">';
                        temp += '<p>客服</p>';
                        temp += '</li>';
                        temp += '<li id="fllow">';
                        temp += '<img id="sg_ic_shoucang_1" src="../../style/images/sg_ic_shoucang_1.png">';
                        temp += '<p>收藏</p>';
                        temp += '</li>';
                        temp += '<li id="shopCar">';
                        temp += '<img src="../../style/images/pro_btn_shopping_n.png">';
                        temp += '<p>购物车</p>';
                        temp += '</li>';
                        temp += '</ul>';
                        temp += '<div class="pay" id="buy">立即购买</div>';
                        temp += '<div class="pay" id="jion_car" style="background:#ff2640; color:#fff;">加入购物车</div>';
                        $("#footer").append(temp);
                    }
                    indexJs.follow();
                    price = $goodinfo.discount_price;
                    // console.log(price);
                });

            },
            //加入收藏
            follow: function () {
                var data = {
                    apiCode: '_follow_add_001',
                    userToken: window.localStorage.getItem("userToken"),
                    goods_id: QueryString.id
                };
                http(data, function (responed) {
                    // console.log(responed);
                    var $info = responed.info;
                    if ($info == "已关注过") {
                        $("#sg_ic_shoucang_1").attr("src", "../../style/images/sg_ic_shoucang_2.png");
                        $("#fllow").click(function () {
                            indexJs.followCancel();
                        })
                    } else {
                        $("#sg_ic_shoucang_1").attr("src", "../../style/images/sg_ic_shoucang_1.png");
                    }
                })
            },
            followCancel: function () {
                var data = {
                    apiCode: '_follow_cancel_001',
                    userToken: window.localStorage.getItem("userToken"),
                    goods_id: QueryString.id
                };
                http(data, function (responed) {
                    // console.log(responed);
                    $("#sg_ic_shoucang_1").attr("src", "../../style/images/sg_ic_shoucang_1.png");
                    $("#fllow").one().click(function () {
                        indexJs.follow();
                        $("#sg_ic_shoucang_1").attr("src", "../../style/images/sg_ic_shoucang_1.png");
                    });

                })
            },
            //生成订单
            shopingCar: function () {
                var data = {
                    apiCode: '_set_crad_001',
                    userToken: window.localStorage.getItem("userToken"),
                    good_id: QueryString.id,
                    count: 1,
                    price: 22,
                    type: 2,

                };
                http(data, function (responed) {
                    // console.log(responed);
                    var $info = responed.info;
                    
                })
            },
           //生成订单
           setOrder1:function(){
               var data = {
                apiCode:'_order_001',
                userToken:window.localStorage.getItem("userToken"),
                receipt_id:'',
                type:1,
                good_info:'[{"good_id":"'+QueryString.id+'","count":"1","price":"'+good_price+'","type":"1"}]',
                amount:good_price,
                postage:postage,
                auto:1
               };
               http(data, function(responed){
                   console.log(responed);
                   var $info=responed.info;
                   if ($info.id) {
                        window.location.href="../myGroup/confirmOrder.html?type=1&id="+$info.id;
                    }
               })
           },
           setOrder2:function(){
               var data = {
                apiCode:'_order_001',
                userToken:window.localStorage.getItem("userToken"),
                receipt_id:'',
                type:2,
                good_info:'[{"good_id":"'+QueryString.id+'","count":"1","price":"'+good_price+'","type":"2"}]',
                postage:postage,
                amount:good_price
               };
               http(data, function(responed){
                   console.log(responed);
                   var $info=responed.info;
                   if ($info.id) {
                        window.location.href="../myGroup/confirmOrder.html?type=2&id="+$info.id;
                    }
               })
           }
        };
        // indexJs.shopingCar();
        indexJs.getuser();
        indexJs.getfruit();
        // indexJs.setOrder2();
        // indexJs.setOrder();
        // $("#shopCar").click(function(){
        //     indexJs.shopingCar();
        // // });
        // $("#buy").click(function () {
        //     // console.log(111);

        // });
//        $("#fllow").click(function(){
//            indexJs.follow();
//        });
//        $("#buy").click(function(){
//            indexJs.setOrder();
////            window.location.href="../myGroup/confirmOrder.html"
//        });
    });
</script>
</body>
</html>